package com.pw.study.leetcode;

import java.util.Arrays;
import java.util.stream.Stream;

/**
 * 寻找数组中心索引
 */
public class Lc {
    public static void main(String[] args) {
        int[] nums ={1,7,3,6,5,6};
        int all=0;
        for (int i = 0; i <nums.length ; i++) {
            all+=nums[i];
        }
        System.out.println("all:"+all);
        int left=0;
        for (int i = 0; i <nums.length ; i++) {
            if(left*2+nums[i]==all){
                System.out.println("iiii"+i);
                break;
            }else{
                left += nums[i];
            }
        }
        System.out.println("什么都没有i");
    }
}
